package cn.cai.service.impl;

import cn.cai.mapper.BasicInformationMapper;
import cn.cai.pojo.BasicInformation;
import cn.cai.service.BasicInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BasicInformationServiceImpl implements BasicInformationService {
    @Autowired
    private BasicInformationMapper basicInformationMapper;

    /**
     * 查询所有基本信息
     * @return
     */
    @Override
    public List<BasicInformation> selectAll() {
        return basicInformationMapper.selectAll();
    }

    /**
     * 添加一条基本信息到基本信息表中
     * @param basicInformation 一条基本信息
     * @return 是否添加成功
     */
    @Override
    public Boolean addInformation(BasicInformation basicInformation) {
        Integer integer = basicInformationMapper.inertInfromation(basicInformation);
        return integer == 1;
    }

    /**
     * 根据传入的学号删除基本信息
     * @param xh 要删除上报信息的学号
     * @return 是否删除成功
     */
    @Override
    public Boolean deleteInformation(String xh) {
        Integer result = basicInformationMapper.deleteInformation(xh);
        return result == 1;
    }
}
